Skip to content

Conversation

@turuslan
Copy link
Contributor

gossip.publish(topic_hash, data) without gossip.subscribe(topic_hash) for publish only mode

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a "publish-only" mode for gossipsub topics, allowing nodes to publish messages without subscribing to a topic. This is useful for fanout publishing scenarios where a node only needs to send messages but not receive them.

Changes:

  • Added publish_only_ flag to Topic class to distinguish between subscribed and publish-only topics
  • Implemented Gossip::publish(TopicHash, BytesIn) method that creates publish-only topics
  • Added fanout TTL-based cleanup for publish-only topics in the heartbeat function
  • Skip sending GRAFT/subscription messages for publish-only topics to peers

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
include/libp2p/protocol/gossip/gossip.hpp Added publish_only_ flag to Topic, last_publish_ timestamp, new publish method, and made meshOutCount() const
include/libp2p/protocol/gossip/config.hpp Added fanout_ttl configuration parameter for publish-only topic cleanup
src/protocol/gossip/gossip.cpp Implemented publish-only logic: topic creation, peer selection, mesh management, and cleanup
include/qtils/retain_if.hpp Added utility function to filter containers in-place based on predicate

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@turuslan turuslan requested a review from xDimon January 16, 2026 09:16
@turuslan turuslan merged commit 9479291 into main Jan 16, 2026
2 checks passed
@turuslan turuslan deleted the feature/gossip-fanout branch January 21, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants